package com.group.elmboot.controller;

import com.group.elmboot.po.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.group.elmboot.service.UserService;
@RefreshScope//开启动态刷新
@RestController
@RequestMapping("/UserController")
public class UserController {
	
	@Autowired
	private UserService userService;

	@RequestMapping("/getUserByIdByPass")
	public User getUserByIdByPass(User user) throws Exception{
		return userService.getUserByIdByPass(user);
	}
	
	@RequestMapping("/getUserById")
	public int getUserById(User user) throws Exception{
		return userService.getUserById(user.getUserId());
	}
	
	@RequestMapping("/saveUser")
	public int saveUser(User user) throws Exception{
		return userService.saveUser(user);
	}
	
	@RequestMapping("/updateUser")
	public int updateUser(User user) throws Exception{
		return userService.updateUser(user);
	}
	
	@RequestMapping("/sendValidation")
	public int sendValidation(User user) throws Exception{
		return userService.sendValidation(user.getUserId());
	}
	
	@RequestMapping("/updatePassword")
	public int updatePassword(User user) throws Exception{
		return userService.updatePassword(user);
	}
}
